{
  "name": "Case 5 – Government Tender Pre-Qualification",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2,
      "position": [0, 0],
      "parameters": {
        "formTitle": "Government Tender – Technical Bid Submission",
        "formDescription": "Upload vendor technical proposal for pre-qualification",
        "formFields": {
          "values": [
            { "fieldLabel": "Bidder Name", "requiredField": true },
            { "fieldLabel": "Email id", "fieldType": "email", "requiredField": true },
            {
              "fieldLabel": "Technical_Proposal",
              "fieldType": "file",
              "acceptFileTypes": ".pdf",
              "requiredField": true
            }
          ]
        }
      }
    },
    {
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [220, 0],
      "parameters": {
        "inputDataFieldName": "Technical_Proposal",
        "name": "={{ $json['Bidder Name'] + '_Technical_Proposal' }}",
        "folderId": "REPLACE_WITH_TENDER_FOLDER_ID"
      }
    },
    {
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [420, 0],
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.id }}"
      }
    },
    {
      "name": "Extract Proposal",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [620, 0],
      "parameters": { "operation": "pdf" }
    },
    {
      "name": "Download RFP Criteria",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [820, 0],
      "parameters": {
        "operation": "download",
        "fileId": "REPLACE_WITH_RFP_CRITERIA_FILE_ID"
      }
    },
    {
      "name": "Extract RFP Criteria",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [1020, 0],
      "parameters": { "operation": "pdf" }
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [220, 260],
      "parameters": {
        "promptType": "define",
        "text": "=Vendor Technical Proposal:\n{{ $('Extract Proposal').item.json.text }}\n\nRFP Pre-Qualification Criteria:\n{{ $('Extract RFP Criteria').item.json.text }}",
        "options": {
          "systemMessage": "You are a Government Tender Evaluation Analyst. Evaluate strictly as per RFP. Output ONLY valid JSON and call the Google Sheets Append Row tool."
        }
      }
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [0, 420],
      "parameters": {
        "model": { "mode": "list", "value": "gpt-4.1-mini" }
      }
    },
    {
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4,
      "position": [420, 460],
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_GOOGLE_SHEET_ID",
        "sheetName": "Government Tender – Pre-Qualification Evaluation Register"
      }
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [420, 260],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json['Email id'] }}",
        "subject": "Government Tender – Technical Evaluation Outcome",
        "message": "={{ 'Dear ' + $('On form submission').item.json['Bidder Name'] + ',<br><br>Your technical bid has been evaluated as per tender conditions. You will be informed separately regarding eligibility for financial bid opening.<br><br>Regards,<br>Tender Evaluation Committee' }}"
      }
    }
  ],
  "connections": {
    "On form submission": { "main": [[{ "node": "Upload file" }]] },
    "Upload file": { "main": [[{ "node": "Download file" }]] },
    "Download file": { "main": [[{ "node": "Extract Proposal" }]] },
    "Extract Proposal": { "main": [[{ "node": "Download RFP Criteria" }]] },
    "Download RFP Criteria": { "main": [[{ "node": "Extract RFP Criteria" }]] },
    "Extract RFP Criteria": { "main": [[{ "node": "AI Agent" }]] },
    "OpenAI Chat Model": { "ai_languageModel": [[{ "node": "AI Agent" }]] },
    "Append row": { "ai_tool": [[{ "node": "AI Agent" }]] },
    "AI Agent": { "main": [[{ "node": "Send Email" }]] }
  },
  "active": false
}
